<template>
    <div>
        <h3>Parent</h3>
        <!-- 自定义事件someEvent要写到前面才生效 -->
        <Child @someEvent="getDataFromChild" :title="title" :names="names" :age="age"></Child>
        <div>Msg from Child: {{ msgFromChild }}</div>
    </div>
</template>

<script>
import Child from './Child.vue';
export default {
    data () {
        return {
            title:'this is a title',
            names:['a','b','c'],
            // age: 20,
            user:{
                name:'haha',
                age:120
            },
            msgFromChild: ''
        }
    },
    components:{
        Child
    },
    methods:{
        getDataFromChild(data){
            this.msgFromChild = data;
        }
    }
}
</script>

<style lang="scss" scoped>

</style>